/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.comeval.modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author LUISA
 */
@Entity
@Table(name = "persona")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Persona.findAll", query = "SELECT p FROM Persona p"),
    @NamedQuery(name = "Persona.findByDocumentonitpersona", query = "SELECT p FROM Persona p WHERE p.documentonitpersona = :documentonitpersona"),
    @NamedQuery(name = "Persona.findByNombrepersona", query = "SELECT p FROM Persona p WHERE p.nombrepersona = :nombrepersona"),
    @NamedQuery(name = "Persona.findByApellidopersona", query = "SELECT p FROM Persona p WHERE p.apellidopersona = :apellidopersona"),
    @NamedQuery(name = "Persona.findByDireccionpersona", query = "SELECT p FROM Persona p WHERE p.direccionpersona = :direccionpersona"),
    @NamedQuery(name = "Persona.findByTelefonopersona", query = "SELECT p FROM Persona p WHERE p.telefonopersona = :telefonopersona"),
    @NamedQuery(name = "Persona.findByCorreopersona", query = "SELECT p FROM Persona p WHERE p.correopersona = :correopersona"),
    @NamedQuery(name = "Persona.findByMunicipiopersona", query = "SELECT p FROM Persona p WHERE p.municipiopersona = :municipiopersona"),
    @NamedQuery(name = "Persona.findByClavepersona", query = "SELECT p FROM Persona p WHERE p.clavepersona = :clavepersona")})
public class Persona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "documentonitpersona")
    private String documentonitpersona;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "nombrepersona")
    private String nombrepersona;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "apellidopersona")
    private String apellidopersona;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "direccionpersona")
    private String direccionpersona;
    @Column(name = "telefonopersona")
    private Integer telefonopersona;
    @Size(max = 50)
    @Column(name = "correopersona")
    private String correopersona;
    @Size(max = 100)
    @Column(name = "municipiopersona")
    private String municipiopersona;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "clavepersona")
    private String clavepersona;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "asesorpedido")
    private Collection<Pedido> pedidoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "clientepedido")
    private Collection<Pedido> pedidoCollection1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "remitentepqrs")
    private Collection<Pqrs> pqrsCollection;
    @JoinColumn(name = "codigorol", referencedColumnName = "codigorol")
    @ManyToOne(optional = false)
    private Rol codigorol;

    public Persona() {
    }

    public Persona(String documentonitpersona) {
        this.documentonitpersona = documentonitpersona;
    }

    public Persona(String documentonitpersona, String nombrepersona, String apellidopersona, String direccionpersona, String clavepersona) {
        this.documentonitpersona = documentonitpersona;
        this.nombrepersona = nombrepersona;
        this.apellidopersona = apellidopersona;
        this.direccionpersona = direccionpersona;
        this.clavepersona = clavepersona;
    }

    public String getDocumentonitpersona() {
        return documentonitpersona;
    }

    public void setDocumentonitpersona(String documentonitpersona) {
        this.documentonitpersona = documentonitpersona;
    }

    public String getNombrepersona() {
        return nombrepersona;
    }

    public void setNombrepersona(String nombrepersona) {
        this.nombrepersona = nombrepersona;
    }

    public String getApellidopersona() {
        return apellidopersona;
    }

    public void setApellidopersona(String apellidopersona) {
        this.apellidopersona = apellidopersona;
    }

    public String getDireccionpersona() {
        return direccionpersona;
    }

    public void setDireccionpersona(String direccionpersona) {
        this.direccionpersona = direccionpersona;
    }

    public Integer getTelefonopersona() {
        return telefonopersona;
    }

    public void setTelefonopersona(Integer telefonopersona) {
        this.telefonopersona = telefonopersona;
    }

    public String getCorreopersona() {
        return correopersona;
    }

    public void setCorreopersona(String correopersona) {
        this.correopersona = correopersona;
    }

    public String getMunicipiopersona() {
        return municipiopersona;
    }

    public void setMunicipiopersona(String municipiopersona) {
        this.municipiopersona = municipiopersona;
    }

    public String getClavepersona() {
        return clavepersona;
    }

    public void setClavepersona(String clavepersona) {
        this.clavepersona = clavepersona;
    }

    @XmlTransient
    public Collection<Pedido> getPedidoCollection() {
        return pedidoCollection;
    }

    public void setPedidoCollection(Collection<Pedido> pedidoCollection) {
        this.pedidoCollection = pedidoCollection;
    }

    @XmlTransient
    public Collection<Pedido> getPedidoCollection1() {
        return pedidoCollection1;
    }

    public void setPedidoCollection1(Collection<Pedido> pedidoCollection1) {
        this.pedidoCollection1 = pedidoCollection1;
    }

    @XmlTransient
    public Collection<Pqrs> getPqrsCollection() {
        return pqrsCollection;
    }

    public void setPqrsCollection(Collection<Pqrs> pqrsCollection) {
        this.pqrsCollection = pqrsCollection;
    }

    public Rol getCodigorol() {
        return codigorol;
    }

    public void setCodigorol(Rol codigorol) {
        this.codigorol = codigorol;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (documentonitpersona != null ? documentonitpersona.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Persona)) {
            return false;
        }
        Persona other = (Persona) object;
        if ((this.documentonitpersona == null && other.documentonitpersona != null) || (this.documentonitpersona != null && !this.documentonitpersona.equals(other.documentonitpersona))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.comeval.modelo.Persona[ documentonitpersona=" + documentonitpersona + " ]";
    }
    
}
